home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / MacTechNotes / Platforms & Tools / Stand-Alone Code Folder / Persistƒ / PersistTest.p < prev    next >
Encoding:
Text File  |  1990-07-24  |  716 b   |  43 lines  |  [TEXT/MPS ]

  1.  
  2. PROGRAM TestApp;
  3.  
  4. USES
  5.     Types, Resources, Memory, OSUtils;
  6.  
  7. CONST
  8.     N = 5;
  9.     kAccumulate = 0;    {These are the control messages.}
  10.     kFirstTime = 1;
  11.     kLastTime = 2;
  12.     
  13. VAR
  14.     i : Integer;
  15.     acc : Longint;
  16.     h1, otherA5: Handle;
  17.     
  18.  
  19.     FUNCTION CallModule (parm: Longint; message: Integer; VAR otherA5: Handle;
  20.         modHandle: Handle) : Longint;
  21.     INLINE    $205F,
  22.             $2050,
  23.             $4E90;
  24.     
  25.     
  26. BEGIN
  27.     h1 := GetResource('CUST',129);
  28.     MoveHHi(h1);
  29.     HLock(h1);
  30.  
  31.     FOR i := 1 TO N DO
  32.         BEGIN
  33.             CASE i OF
  34.                 1: acc := CallModule(i,kFirstTime,otherA5,h1);
  35.                 N: acc := CallModule(i,kLastTime,otherA5,h1);
  36.             OTHERWISE
  37.                 acc := CallModule(i,kAccumulate,otherA5,h1);
  38.             END;
  39.             WriteLn('SumSquares after ',i,' = ',acc);
  40.         END;
  41.     HUnlock(h1);
  42. END.
  43.